/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.team.app.model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.Size;

/**
 *
 * @author donnv
 */
@Entity
@Table(name = "vehicle", catalog = "", schema = "")
public class Vehicle implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "vehicle_id")
    private Long vehicleId;
    @Column(name = "year")
    @Temporal(TemporalType.DATE)
    private Date year;
    @Size(max = 45)
    @Column(name = "color", length = 45)
    private String color;
    @Size(max = 45)
    @Column(name = "reg_number", length = 45)
    private String regNumber;
    @Column(name = "fuel_type")
    private Long fuelType;
    @Column(name = "transmission")
    private Long transmission;
    @Column(name = "status")
    private Long status;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "daily_price", precision = 22)
    private Double dailyPrice;
    @Column(name = "is_status")
    private Long isStatus;
    @Lob
    private String image;
    @OneToOne(mappedBy = "vehicleId")
    private Rentprice rentprice;
    @JoinColumn(name = "model_id", referencedColumnName = "model_id", nullable = false)
    @ManyToOne(optional = false)
    private Model modelId;
    @JoinColumn(name = "company_id", referencedColumnName = "company_id")
    @ManyToOne
    private Company companyId;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "vehicleId")
    private List<Feedback> feedbackList;
    @OneToMany(mappedBy = "vehicleId")
    private List<Reservation> reservationList;

    public Vehicle() {
    }

    public Vehicle(Long vehicleId) {
        this.vehicleId = vehicleId;
    }

    public Long getVehicleId() {
        return vehicleId;
    }

    public void setVehicleId(Long vehicleId) {
        this.vehicleId = vehicleId;
    }

    public Date getYear() {
        return year;
    }

    public void setYear(Date year) {
        this.year = year;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public String getRegNumber() {
        return regNumber;
    }

    public void setRegNumber(String regNumber) {
        this.regNumber = regNumber;
    }

    public Long getFuelType() {
        return fuelType;
    }

    public void setFuelType(Long fuelType) {
        this.fuelType = fuelType;
    }

    public Long getTransmission() {
        return transmission;
    }

    public void setTransmission(Long transmission) {
        this.transmission = transmission;
    }

    public Long getStatus() {
        return status;
    }

    public void setStatus(Long status) {
        this.status = status;
    }

    public Double getDailyPrice() {
        return dailyPrice;
    }

    public void setDailyPrice(Double dailyPrice) {
        this.dailyPrice = dailyPrice;
    }

    public Long getIsStatus() {
        return isStatus;
    }

    public void setIsStatus(Long isStatus) {
        this.isStatus = isStatus;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public Rentprice getRentprice() {
        return rentprice;
    }

    public void setRentprice(Rentprice rentprice) {
        this.rentprice = rentprice;
    }

    public Model getModelId() {
        return modelId;
    }

    public void setModelId(Model modelId) {
        this.modelId = modelId;
    }

    public Company getCompanyId() {
        return companyId;
    }

    public void setCompanyId(Company companyId) {
        this.companyId = companyId;
    }

    public List<Feedback> getFeedbackList() {
        return feedbackList;
    }

    public void setFeedbackList(List<Feedback> feedbackList) {
        this.feedbackList = feedbackList;
    }

    public List<Reservation> getReservationList() {
        return reservationList;
    }

    public void setReservationList(List<Reservation> reservationList) {
        this.reservationList = reservationList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (vehicleId != null ? vehicleId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Vehicle)) {
            return false;
        }
        Vehicle other = (Vehicle) object;
        if ((this.vehicleId == null && other.vehicleId != null) || (this.vehicleId != null && !this.vehicleId.equals(other.vehicleId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.team.app.model.Vehicle[ vehicleId=" + vehicleId + " ]";
    }
    
}
